/**
	License:		Artistic license 2.0 (see license.txt, also available online at http://www.perlfoundation.org/artistic_license_2_0)
	Authors:		OrbitalLab (http://www.orbitallab.ru/moonglide/), 2007-2009

	File:			ResPTex.d
	Description:	tex generation
	Date:			13.11.2007 by Jurec
*/
module moonglide.resources.resproc.texture.ResPTex;

import
	moonglide.resources.resobjects.lowlevel.ResTextureData,
    moonglide.resources.resobjects.lowlevel.ResShader,
    moonglide.renderer.IRendererOffscreen;
//import moonglide.core.EngineCore : CEngineCore;

//================================================================
/// fill texture
//================================================================
CResTextureData GenTexFill()
{
	CResTextureData pTex = CResTextureData( "Fill" );
	pTex.CreateTempTex(128, 128, IL_BGR, IL_UNSIGNED_BYTE);
	pTex.FillColor();

	return pTex;
}




/*
class CTextureFilter
{
    protected:
        CResTextureData _result = null;
        CResTextureData _input = null;
    public:
        void setInput( CResTextureData _in )
        {
            _input = _in;
        }

        CResTextureData getResult()
        {
            return _result;
        }

        void process()
        {
        }
}

class CTextureFilterBlur : public CTextureFilter
{
    protected:
        CResShaderComposite _blur;
        IRenderTarget _texRend;
    public:
        void process()
        {
            _texRend.bind;
            with ( CEngineCore().renderer )
            {
                materialSys.resBinder.bindShader( _blur );
                materialSys.resBinder.bindTexture( _input );

                fullScreenQuad();

                materialSys.resBinder.unBindTexture( _input );
                materialSys.resBinder.unBindShader( _blur );
            }
            _texRend.unbind;
        }

        void setInput( CResTextureData _in )
        {
            super.setInput( _in );
            if (_texRend )
                _texRend.release;

//			_texRend = CEngineCore().renderer.offscreenMan.createRenderTarget( _in );
        }


        this()
        {
            const char[] verShader = "data/v_blur.glsl";
            const char[] pixShader = "data/f_blur.glsl";

            _blur = CResShaderComposite("filtBlur_shader");
            _blur.setProg (sh_Vertex , CResShader (verShader, true));
			_blur.setProg (sh_Fragment, CResShader (pixShader, true));
			_blur.addLocal ("blurimage", 0 , true);
			_blur.addLocal ("blur_offset", 1 , false);
        }
        ~this()
        {
            if (_texRend )
                _texRend.release;

			if( _blur )
            	_blur.release;
        }
}
*/
